package com.unlcn.ils.kas.test;

import com.unlcn.ils.kas.WebApplication;
import org.joda.time.DateTime;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.text.SimpleDateFormat;
import java.util.Date;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes= WebApplication.class)
public class OrderSchedule {


    @Test
    public void testOrderTime(){

        // 获取订单号
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm:ss");
        String format = "yyyy-MM-dd HH:mm:ss";
        Date date = new Date();
        String strDate = sdf.format(date.getTime());
        String strTime = sdf2.format(date.getTime());
        String strDt1 = strDate + "T" + strTime;
        DateTime dt2 = new DateTime(strDt1);
        String endTime = dt2.toString(format);
        System.out.println(endTime);
        DateTime dt3 = dt2.minusDays(1);
        String startTime = dt3.toString(format);
        System.out.println(startTime);


    }

}
